package com.atguigu.servlet;

import javax.servlet.*;
import java.io.IOException;
import java.util.Enumeration;

public class SecondServlet implements Servlet {
    //怎么看什么时候是劣化
    public SecondServlet(){
        System.out.println("SecondServlet-->实例化");

    }

    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
//        System.out.println("SecondServlet-->初始化");
        ServletContext servletContext = servletConfig.getServletContext();
        String sccope = (String) servletContext.getAttribute("Sccope");
        System.out.println(sccope);



    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
        System.out.println("SecondServlet-->服务");
        req.getRequestDispatcher("/test/success.html").forward(req,res);

    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {
        System.out.println("SecondServlet-->销毁");

    }
}
